<?php
  
  require_once('inc_admin.php');
  //连接数据库   
  connect();

  if(!empty($_FILES["pic"]["name"])){
    $pic = uploadfile('pic','../images/',array('jpg','gif','png'));
  }
  else{
    $pic='';
  }

  

  $data = array(
    'videoname' => trim($_POST['videoname']),
    'tid' => trim($_POST['tid']),
    'pic' => $pic,
    'intro' => trim($_POST['intro']),
    'uploaddate' => trim($_POST['uploaddate']),
    'uploadadmin' => trim($_POST['uploadadmin']),
    'hittimes' => trim($_POST['hittimes']),
    'downtimes' => trim($_POST['downtimes']),
    'address' => trim($_POST['address'])
    );


  //执行SQL语句
  $result = add('videos',$data);

  if(!$result){
    echo "添加失败！<br/>";
    echo "<a href='videoform.html'>返回</a>";   
  }else{    
  redirect('video-list.php','添加成功！');
  }    
  
?>

